<?php 
$progress = 0; 
if($adc->getCurrentAdTypeId() > 0)
{ $progress = 1; $pbar = 25; }

if(($progress == 1) && ($adc->getCurrentAdCatId() > 0))
{ $progress = 2; $pbar = 50; }

if(($progress == 2) && ($adc->getCurrentAdBrandId() > 0))
{ $progress = 3; $pbar = 75; }
?>
<form id="<?php echo $com->Id; ?>_new_ad_wizard" action="" method="post" enctype="multipart/form-data" name="new_ad_wizard">
	<div class="progress progress-striped">
        <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="<?php echo $pbar; ?>" aria-valuemin="0" aria-valuemax="100" style="width: <?php echo $pbar; ?>%;">
        	<span class="sr-only"><?php echo $pbar; ?>% <?php echo ucfirst($txt->getWord('complete')); ?></span>
        </div>
    </div>
	<div class="panel-group" id="newprospect">
    	<div class="panel panel-default">
        	<div class="panel-heading">
            	<h4 class="panel-title">
                    <a class="accordion-toggle" data-toggle="collapse" data-parent="#newprospect" href="#stepcat">
                        <?php echo ucfirst($txt->getWord('step')); ?> 1 - <?php echo ucfirst($txt->getWord('choose').' '.$txt->getWord('category')); ?>
                    </a>
                </h4>
            </div>
            <div id="stepcat" class="panel-collapse collapse <?php if($progress == 0) { echo 'in'; } ?>">
           		<div class="panel-body">
                	<div class="row">
						<?php 
                        if($adc->getAdTypes())
                        {
                            $i=0;
                            foreach($adc->getAdTypes() as $type)
                            { 
                                $class = '';
                                if($adc->getCurrentAdTypeId() == $type->getId())
                                { $class = 'selected active'; }
                                ?>
                                <div class="col-md-2 col-sm-3">
                                    <a class="btn btn-default btn-block prospect-type <?php echo $class; ?>" href="/c/11/?edit=ad&typeId=<?php echo $type->getId(); ?>">
                                        <img height="50" src="<?php echo $type->getImageUrl(); ?>" alt="<?php echo $type->getTitle(); ?>"  /><br />
                                        <?php echo $type->getTitle(); ?>
                                    </a>
                                </div>
                                <?php
                                $i++;
                                if(($i%6) == 0)
                                { echo '</div><div class="row">'; }
                            }
                        }
                        ?>
                        <?php echo $controller->getForm('ad_cat_wizard')->getField('typeId')->getHTML(); ?>
                    </div>
                </div>
            </div>
        </div>
        <div class="panel panel-default">
        	<div class="panel-heading">
            	<h4 class="panel-title">
                    <a class="accordion-toggle" data-toggle="collapse" data-parent="#newprospect" href="#stepsubcat">
                        <?php echo ucfirst($txt->getWord('step')); ?> 2 - <?php echo ucfirst($txt->getWord('choose').' '.$txt->getWord('subcategory')); ?>
                    </a>
                </h4>
            </div>
            <div id="stepsubcat" class="panel-collapse collapse <?php if($progress == 1) { echo 'in'; } ?>">
            	<div class="panel-body">
                	<div class="row">
					<?php 
                    if($adc->getAdCats())
                    {
                        $i=1;
                        foreach($adc->getAdCats() as $cat)
                        { 
                            $class = '';
                            if($adc->getCurrentAdCatId() == $cat->getId())
                            { $class = 'selected'; }
                            
                            if($adc->getCurrentAdTypeId() == $cat->getTypeId())
                            {  
                                ?>
                                <div class="col-md-2 col-sm-3">
                                    <a class="prospect-cat btn btn-default btn-block <?php echo $class; ?>" href="/c/11/?edit=ad&typeId=<?php echo $cat->getTypeId(); ?>&catId=<?php echo $cat->getId(); ?>">
                                        <img width="<?php echo $adc->getSetting('CatListW'); ?>" src="<?php echo $cat->getImageObject()->getLink($adc->getSetting('CatListW'), $adc->getSetting('CatListH')); ?>" alt="#"  /><br />
                                        <?php echo $cat->getTitle(); ?>
                                    </a>
                                </div>
                                <?php
                                if(($i%6) == 0)
                                { echo '</div><div class="row">'; }
                                $i++;
                            }
                            
                        }
                    }
                    ?>
                    </div>
                </div>
                <?php echo $controller->getForm('ad_cat_wizard')->getField('catId')->getHTML(); ?>
            </div>
        </div>
        <div class="panel panel-default">
        	<div class="panel-heading">
            	<h4 class="panel-title">
                    <a class="accordion-toggle" data-toggle="collapse" data-parent="#newprospect" href="#stepbrand">
                        <?php echo ucfirst($txt->getWord('step')); ?> 3 - <?php echo ucfirst($txt->getWord('choose').' '.$txt->getWord('brand')); ?>
                    </a>
                </h4>
            </div>
            <div id="stepbrand" class="panel-collapse collapse <?php if($progress == 2) { echo 'in'; } ?>">
            	<div class="panel-body">
                	<div class="row">
					<?php 
                    $i=1;
                    foreach($adc->getAdBrands() as $brand)
                    {
                        if($adc->getCurrentAdBrandId() == $brand->getId())
                        { $selected = 'active'; }
                            
                        $link = $katana->getURL();
                        $link .= '/c/11/?edit=ad&typeId='.$adc->getCurrentAdTypeId().'&catId='.$adc->getCurrentAdCatId().'&brandId='.$brand->getId();
                        
                        echo '<div class="col-md-2 col-sm-3 center '.$class.'">';
                        echo 	'<a class="btn btn-default btn-block prospect-brand '.$selected.'" href="'.$link.'">';
                        if($adc->getSetting('BrandImages'))
                        {
                            if(is_object($brand->getImageObject()))
                            { 
                                
                                echo '<img title="'.$brand->getTitle().'" alt="'.$brand->getTitle().'" src="'.$brand->getImageObject()->getLink($adc->getSetting('BrandListW'), $adc->getSetting('BrandListH')).'" alt="'.$brand->getTitle().'" /><br />';
                                ; 
                            }
                        }
                        echo 		$txt->truncate($brand->getTitle(), 25, '', '');
                        echo 	'</a>';
                        echo '</div>';
                        
                        if(($i%6) == 0)
                        { echo '</div><div class="row">'; }
                        $i++;
                        
                        $class = '';
                        $selected = '';
                    }
                    ?>
                	</div>
                </div>
                <?php echo $controller->getForm('ad_cat_wizard')->getField('brandId')->getHTML(); ?>
            </div>
        </div>
        <div class="panel panel-default">
            <div class="panel-heading">
            	<h4 class="panel-title">
                    <a class="accordion-toggle" data-toggle="collapse" data-parent="#newprospect" href="#steptype">
                        <?php echo ucfirst($txt->getWord('step')); ?> 4 - <?php echo ucfirst($txt->getWord('ad_type')); ?>
                    </a>
                </h4>
            </div>
        	<div id="steptype" class="panel-collapse collapse  <?php if($progress == 3) { echo 'in'; } ?>">
            	<div class="panel-body">
                	<div class="row-fluid">
                    	<div class="span12">
							<?php echo $controller->getForm('new_ad_wizard')->getFieldsHTML(); ?>
                            <div class="form-field-v-space">&nbsp;</div>
                            <div id="proceedButton">
                            <?php if($adc->getSetting('SaleTermsPage') > 0): ?>
                            <strong>
                            Ved &aring; klikke p&aring; <?php echo $txt->getWord('proceed'); ?> s&aring; aksepterer du <a target="_blank" href="/m/<?php echo $adc->getSetting('SaleTermsPage'); ?>/"><?php echo ucfirst($txt->getWord('saleterms')); ?></a>.<br />
                            <a target="_blank" href="/m/<?php echo $adc->getSetting('SaleTermsPage'); ?>/">Klikk her for &aring; lese <?php echo $txt->getWord('saleterms'); ?></a></strong><br /><br />
                            <?php endif; ?>
                            <?php
                            $buttons[0]['title'] = ucfirst($txt->getWord('proceed').' >>');
                            $buttons[0]['href'] = '';
                            $buttons[0]['onclick'] = 'document.getElementById(\''.$com->getId().'_new_ad_wizard\').submit();';
                            $buttons[0]['params']['class'] = 'btn btn-success';
                            ?><br />
                                <div class="form-actions">
                                	<?php echo getButtonsHTML($theme->HFBSets[$theme->ComHFB]['button'], $buttons); ?>
                            	</div>
                            </div>
                            <input type="hidden" name="action" value="new_ad_wizard" /> 
                            <input id="<?php echo $com->Id; ?>_new_ad_stealth" type="hidden" name="stealth_<?php echo md5(date("m-d-w")); ?>" value="" /><br clear="all" />
                            <br /><hr /><br />
                            <?php echo $adc->getSetting('PriceInfo'); ?>
                            <div class="clear"></div>
                        </div>
                	</div>
            	</div>
            </div>
			<?php echo $controller->getForm('ad_cat_wizard')->getField('catId')->getHTML(); ?>
        </div>
    </div>
</form><br /><br />